// eslint-disable-next-line
import {
  UserLayout,
  BasicLayout,
  BlankLayout,
  PageView
} from '@/layouts'

export const asyncRouterMap = [

  {
    path: '/',
    name: 'index',
    component: BasicLayout,
    meta: {
      title: '首页'
    },
    redirect: '/dashboard/workplace',
    children: [
      // dashboard
      {
        path: '/dashboard/workplace',
        name: 'Workplace',
        component: () => import('@/views/dashboard/Workplace'),
        meta: {
          title: '控制台',
          keepAlive: false,
          icon: 'dashboard',
          permission: ['Dashboard']
        }
      },
      {
        path: '/dashboard/workplace',
        name: 'Workplace',
        component: () => import('@/views/stationCon/stationCon'),
        meta: {
          title: '控制台',
          keepAlive: false,
          icon: 'dashboard',
          permission: ['adminDashboard']
        }
      },
      {
        path: '/dashboard/workplace',
        name: 'Workplace',
        component: () => import('@/views/dashboard/Workplace'),
        meta: {
          title: '控制台',
          keepAlive: false,
          icon: 'dashboard',
          permission: ['Command']
        }
      },
      // group
      {
        path: '/group',
        redirect: '/group/new-group',
        component: PageView,
        meta: {
          title: '活动管理',
          icon: 'slack',
          permission: ['New-group']
        },
        children: [{
          path: '/group/new-group',
          name: 'NewGroup',
          component: () => import('@/views/group/NewGroup'),
          meta: {
            title: '活动发布',
            icon: 'smile',
            keepAlive: true,
            permission: ['New-group']
          }
        }
        ]
      },
      // 	Popularize  推广管理
      {
        path: '/popularize',
        redirect: '/popularize/jfk',
        component: PageView,
        meta: {
          title: '推广管理',
          icon: 'slack',
          permission: ['Jfk']
        },
        children: [{
          path: '/popularize/jfk',
          name: 'Jfk',
          component: () => import('@/views/popularize/jfk'),
          meta: {
            title: '京粉客放单',
            icon: 'smile',
            keepAlive: true,
            permission: ['Jfk']
          }
        }
        ]
      },

      // detail
      {
        path: '/detail',
        name: 'detail',
        component: PageView,
        redirect: '/detail/audit-detail',
        meta: {
          title: '商品管理',
          icon: 'shop',
          permission: ['Detail']
        },
        children: [{
          path: '/detail/audit-detail',
          name: 'AuditDetail',
          hideChildrenInMenu: true, // 强制显示 MenuItem 而不是 SubMenu
          component: () => import('@/views/detail/AuditDetail'),
          meta: {
            title: '商品审核',
            icon: 'smile',
            keepAlive: true,
            permission: ['Detail']
          }
        },
        {
          path: '/detail/detail-list',
          name: 'DetailList',
          hideChildrenInMenu: true, // 强制显示 MenuItem 而不是 SubMenu
          component: () => import('@/views/detail/DetailList'),
          meta: {
            title: '商品列表',
            icon: 'smile',
            keepAlive: true,
            permission: ['Detail']
          }
        },
        {
          path: '/detail/effect-detail',
          name: 'EffectDetail',
          component: () => import('@/views/detail/EffectDetail'),
          meta: {
            title: '出单数据',
            icon: 'smile',
            keepAlive: true,
            permission: ['Detail']
          }
        },
        {
          path: '/detail/become',
          name: 'DetailBecome',
          component: () => import('@/views/detail/BecomeDetail'),
          meta: {
            title: '到期商品',
            icon: 'smile',
            keepAlive: true,
            permission: ['Detail']
          }
        },
        {
          path: '/detail/lose',
          name: 'DetailLoss',
          component: () => import('@/views/detail/LossDetail'),
          meta: {
            title: '被撬商品',
            icon: 'smile',
            keepAlive: true,
            permission: ['Detail']
          }
        }

        ]
      },
      // kpi
      {
        path: '/kpi',
        redirect: '/kpi/group',
        component: PageView,
        meta: {
          title: '业绩排行',
          icon: 'ordered-list',
          permission: ['kpi', 'Kpi-all']
        },
        children: [{
          path: '/kpi/group',
          name: 'KpiGroup',
          component: () => import('@/views/kpi/group'),
          meta: {
            title: '我的小组',
            icon: 'smile',
            keepAlive: true,
            permission: ['kpi']
          }
        },
        {
          path: '/kpi/all',
          name: 'KpiAll',
          component: () => import('@/views/kpi/all'),
          meta: {
            title: '整体排行',
            icon: 'smile',
            keepAlive: true,
            permission: ['Kpi-all']
          }
        }]
      },

      // headman
      {
        path: '/headman',
        redirect: '/headman/group',
        component: PageView,
        meta: {
          title: '小组管理',
          icon: 'usergroup-add',
          permission: ['Headman']
        },
        children: [
          {
            path: '/Headman/member',
            name: 'HeadmanMember',
            component: () => import('@/views/headman/member'),
            meta: {
              title: '组员管理',
              icon: 'smile',
              keepAlive: true,
              permission: ['Headman']
            }
          },
          {
            path: '/Headman/user-issueData',
            name: 'userIssueData',
            component: () => import('@/views/headman/userIssueData'),
            meta: {
              title: '小组出单数据',
              icon: 'smile',
              keepAlive: true,
              permission: ['Headman']
            }
          },
          {
            path: '/Headman/user-loseGoods',
            name: 'userLoseGoods',
            component: () => import('@/views/headman/userLoseGoods'),
            meta: {
              title: '小组被翘商品',
              icon: 'smile',
              keepAlive: true,
              permission: ['Headman']
            }
          },
          {
            path: '/Headman/user-passGoods',
            name: 'userPassGoods',
            component: () => import('@/views/headman/userPassGoods'),
            meta: {
              title: '小组通过商品',
              icon: 'smile',
              keepAlive: true,
              permission: ['Headman']
            }
          }
        ]
      },
      // Virtual-pic
      {
        path: '/Virtual',
        redirect: '/Virtual/pic',
        component: PageView,
        meta: {
          title: '虚拟截图',
          icon: 'printer',
          permission: ['Virtual-pic']
        },
        children: [
          {
            path: '/Virtual/jd-apply',
            name: 'JdApply',
            component: () => import('@/views/virtual/JdApply'),
            meta: {
              title: '京东报名',
              icon: 'smile',
              keepAlive: true,
              permission: ['Virtual-pic']
            }
          },
          {
            path: '/Virtual/jd-issue',
            name: 'JdIssue',
            component: () => import('@/views/virtual/JdIssue'),
            meta: {
              title: '京东出单',
              icon: 'smile',
              keepAlive: true,
              permission: ['Virtual-pic']
            }
          }
        ]
      },
      // 知识案例
      {
        path: '/study',
        redirect: '/repository/repository',
        component: PageView,
        meta: {
          title: '知识案例',
          icon: 'fund',
          permission: ['Know-case']
        },
        children: [
          {
            path: '/repository/jd-repository',
            name: 'Repository',
            component: () => import('@/views/repository/repository'),
            meta: {
              title: '知识库',
              icon: 'smile',
              keepAlive: true,
              permission: ['Know-case']
            }
          },
          {
            path: '/repository/answer-detil',
            name: 'AnswerDetil',
            hidden: true,
            hiddenHeaderContent: true,
            component: () => import('@/views/repository/AnswerDetil'),
            meta: {
              title: '回答详情',
              icon: 'smile',
              keepAlive: false,
              permission: ['Know-case']
            }
          },
          {
            path: '/repository/edit-answer',
            name: 'editAnswer',
            hidden: true,
            hiddenHeaderContent: true,
            component: () => import('@/views/repository/editAnswer'),
            meta: {
              title: '编辑',
              icon: 'smile',
              keepAlive: true,
              permission: ['Know-case']
            }
          },
          {
            path: '/caseLibrary/caseLibrary',
            name: 'caseLibrary',
            component: () => import('@/views/caseLibrary/caseLibrary'),
            meta: {
              title: '案例库',
              icon: 'smile',
              keepAlive: true,
              permission: ['Know-case']
            }
          }, {
            path: '/caseLibrary/newcase',
            name: 'newcase',
            hidden: true,
            hideChildrenInMenu: true, // 强制显示 MenuItem 而不是 SubMenu
            component: () => import('@/views/caseLibrary/newcase'),
            meta: {
              title: '案例上传',
              icon: 'smile',
              keepAlive: true,
              permission: ['Know-case']
            }
          }
        ]
      },
      // 新人黑马榜
      {
        path: '/darkhorse/dark-horse',
        name: 'DarkHorse',
        // redirect: '/darkhorse/dark-horse',
        component: () => import('@/views/darkhorse/darkHorse'),
        meta: {
          title: '新人黑马榜',
          icon: 'flag',
          permission: ['New-start']
        }
      },
      // 公告
      {
        path: '/notice/notice-all',
        name: 'NoticeAll',
        component: () => import('@/views/notice/noticeAll'),
        meta: {
          title: '消息管理',
          keepAlive: false,
          icon: 'table',
          permission: ['kpi']
        }
      },
      // ---- 管理后台
      // 活动管理
      {
        path: '/stationCon',
        redirect: '/stationCon/stationCon',
        component: PageView,
        meta: {
          title: '活动管理',
          icon: 'form',
          permission: ['Admin-tem']
        },
        children: [
          {
            path: '/stationCon/activityStencil',
            name: 'activityStencil',
            component: () => import('@/views/stationCon/activityStencil'),
            meta: {
              title: '活动模板',
              icon: 'smile',
              keepAlive: true,
              permission: ['Admin-tem']
            }
          }
        ]
      },
      // 用户管理
      {
        path: '/admin',
        redirect: '/admin/user',
        component: PageView,
        meta: {
          title: '用户管理',
          icon: 'form',
          permission: ['AdminUser']
        },
        children: [{
          path: '/admin/user',
          name: 'AdminUser',
          component: () => import('@/views/admin/user/user'),
          meta: {
            title: '用户审核',
            icon: 'smile',
            keepAlive: true,
            permission: ['AdminUser']
          }
        },
        {
          path: '/admin/abnormal-data',
          name: 'AbnormalData',
          hideChildrenInMenu: true, // 强制显示 MenuItem 而不是 SubMenu
          component: () => import('@/views/admin/AbnormalData/AbnormalData'),
          meta: {
            title: '异常员工',
            icon: 'smile',
            keepAlive: true,
            permission: ['AdminUser']
          }
        },
        {
          path: '/admin/issue-data',
          name: 'issueData',
          hideChildrenInMenu: true, // 强制显示 MenuItem 而不是 SubMenu
          component: () => import('@/views/admin/issueData/issueData'),
          meta: {
            title: '出单数据',
            icon: 'smile',
            keepAlive: true,
            permission: ['AdminUser']
          }
        },
        {
          path: '/admin/leave-data',
          name: 'LeaveData',
          hideChildrenInMenu: true, // 强制显示 MenuItem 而不是 SubMenu
          component: () => import('@/views/admin/LeaveData/LeaveData'),
          meta: {
            title: '离职数据',
            icon: 'smile',
            keepAlive: true,
            permission: ['AdminUser']
          }
        },
        {
          path: '/admin/pass-goods',
          name: 'passGoods',
          hideChildrenInMenu: true, // 强制显示 MenuItem 而不是 SubMenu
          component: () => import('@/views/admin/passGoods/passGoods'),
          meta: {
            title: '通过商品',
            icon: 'smile',
            keepAlive: true,
            permission: ['AdminUser']
          }
        }
        ]
      },
      // 段位管理
      {
        path: '/admin/level-manage',
        name: 'LevelManage',
        component: () => import('@/views/admin/LevelManage/LevelManage'),
        meta: {
          title: '段位管理',
          keepAlive: true,
          icon: 'sketch',
          permission: ['Admin-level']
        }
      },
      // 公告管理
      {
        path: '/admin/notice/notice-man',
        name: 'noticeMan',
        component: () => import('@/views/admin/notice/noticeMan'),
        meta: {
          title: '公告管理',
          keepAlive: true,
          icon: 'sketch',
          permission: ['Admin-notice']
        }
      },
      // 工资管理
      {
        path: '/admin/salary/salary-man',
        name: 'salaryMan',
        component: () => import('@/views/admin/salary/salaryMan'),
        meta: {
          title: '工资管理',
          keepAlive: true,
          icon: 'sketch',
          permission: ['Admin-salary']
        }
      },
      // 小组管理
      {
        path: '/admin/squadman/data-sta',
        redirect: '/admin/squadman/data-sta',
        component: PageView,
        meta: {
          title: '小组管理',
          icon: 'slack',
          permission: ['Admin-squadman']
        },
        children: [{
          path: '/admin/squadman/data-sta',
          name: 'dataSta',
          component: () => import('@/views/admin/squadman/dataSta'),
          meta: {
            title: '数据统计',
            icon: 'smile',
            keepAlive: true,
            permission: ['Admin-squadman']
          }
        }
        ]
      },
      // 知识案例管理
      {
        path: '/study',
        redirect: '/admin/repository/repository',
        component: PageView,
        meta: {
          title: '知识案例',
          icon: 'fund',
          permission: ['Admin-know-case']
        },
        children: [
          {
            path: '/admin/repository/repository',
            name: 'Repository',
            component: () => import('@/views/admin/repository/repository'),
            meta: {
              title: '知识库',
              icon: 'smile',
              name: 'Repository',
              keepAlive: true,
              permission: ['Admin-know-case']
            }
          },
          {
            path: '/admin/repository/answer-detil',
            name: 'AnswerDetil',
            hidden: true,
            hiddenHeaderContent: true,
            component: () => import('@/views/admin/repository/AnswerDetil'),
            meta: {
              title: '回答详情',
              icon: 'smile',
              name: 'AnswerDetil',
              keepAlive: false,
              permission: ['Admin-know-case']
            }
          },
          {
            path: '/admin/repository/edit-answer',
            name: 'editAnswer',
            hidden: true,
            hiddenHeaderContent: true,
            component: () => import('@/views/admin/repository/editAnswer'),
            meta: {
              title: '编辑',
              icon: 'smile',
              keepAlive: true,
              permission: ['Admin-know-case']
            }
          },
          {
            path: '/admin/caseLibrary/caseLibrary',
            name: 'caseLibrary',
            component: () => import('@/views/admin/caseLibrary/caseLibrary'),
            meta: {
              title: '案例库',
              icon: 'smile',
              keepAlive: true,
              permission: ['Admin-know-case']
            }
          }, {
            path: '/admin/caseLibrary/newcase',
            name: 'newcase',
            hidden: true,
            hideChildrenInMenu: true, // 强制显示 MenuItem 而不是 SubMenu
            component: () => import('@/views/admin/caseLibrary/newcase'),
            meta: {
              title: '案例上传',
              icon: 'smile',
              keepAlive: true,
              permission: ['Admin-know-case']
            }
          }
        ]
      },
      // 权限管理
      {
        path: '/permission',
        redirect: '/admin/permission/permission',
        component: PageView,
        meta: {
          title: '权限管理',
          icon: 'slack',
          permission: ['Admin-squadman']
        },
        children: [
          {
            path: '/permission/permission',
            name: 'permission',
            component: () => import('@/views/admin/permission/permission'),
            meta: {
              title: '权限列表',
              icon: 'smile',
              keepAlive: true,
              permission: ['Admin-squadman']
            }
          },
          {
            path: '/permission/role-list',
            name: 'roleList',
            component: () => import('@/views/admin/permission/roleList'),
            meta: {
              title: '角色列表',
              icon: 'smile',
              keepAlive: true,
              permission: ['Admin-squadman']
            }
          },
          {
            path: '/permission/user-permiss',
            name: 'userPermiss',
            component: () => import('@/views/admin/permission/userPermiss'),
            meta: {
              title: '用户列表',
              icon: 'smile',
              keepAlive: true,
              permission: ['Admin-squadman']
            }
          }
        ]
      },
      // 总后台
      {
        path: '/command',
        redirect: '/command/branch',
        component: PageView,
        meta: {
          title: '站点管理',
          icon: 'usergroup-add',
          permission: ['Command']
        },
        children: [{
          path: '/command/branch',
          name: 'CommandBranch',
          component: () => import('@/views/command/branch'),
          meta: {
            title: '站点列表',
            icon: 'smile',
            keepAlive: true,
            permission: ['Command']
          }
        },
        {
          path: '/command/branch-jd',
          name: 'BranchJd',
          component: () => import('@/views/command/branch-jd'),
          meta: {
            title: '京东账号分配',
            icon: 'smile',
            keepAlive: true,
            permission: ['Command']
          }
        }
        ]
      }
    ]
  },
  {
    path: '*',
    redirect: '/404',
    hidden: true
  }
]

/**
 * 基础路由
 * @type { *[] }
 */
export const constantRouterMap = [{
  path: '/user',
  component: UserLayout,
  redirect: '/user/login',
  hidden: true,
  children: [{
    path: 'login',
    name: 'login',
    component: () => import(/* webpackChunkName: "user" */ '@/views/user/Login')
  },
  {
    path: 'register',
    name: 'register',
    component: () => import(/* webpackChunkName: "user" */ '@/views/user/Register')
  },
  {
    path: 'register-result',
    name: 'registerResult',
    component: () => import(/* webpackChunkName: "user" */ '@/views/user/RegisterResult')
  },
  {
    path: 'recover',
    name: 'recover',
    component: () => import(/* webpackChunkName: "user" */ '@/views/user/recover')
  },
  {
    path: 'recoverResult',
    name: 'recoverResult',
    component: () => import(/* webpackChunkName: "user" */ '@/views/user/recoverResult')
  }
  ]
},

{
  path: '/test',
  component: BlankLayout,
  redirect: '/test/home',
  children: [{
    path: 'home',
    name: 'TestHome',
    component: () => import('@/views/Home')
  }]
},

{
  path: '/404',
  component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/404')
}

]
